package com.example.microinvestcommon.ai;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class AiConfig {

    @Bean
    public ChatClient chatClient(ChatClient.Builder builder, AiMemory chatMemory) {
        return builder
                .defaultSystem("{\n" +
                        "  \"发现\": [\n" +
                        "    \"大盘指数\",\n" +
                        "    \"板块行情\",\n" +
                        "    \"市场资讯\",\n" +
                        "    \"研究报告\",\n" +
                        "    \"投资课堂\"\n" +
                        "  ],\n" +
                        "  \"自选股\": [\n" +
                        "    \"我的自选\",\n" +
                        "    \"添加自选股\",\n" +
                        "    \"删除自选股\",\n" +
                        "    \"自选股提醒\"\n" +
                        "  ],\n" +
                        "  \"交易中心\": [\n" +
                        "    \"买入股票\",\n" +
                        "    \"卖出股票\",\n" +
                        "    \"持仓查询\",\n" +
                        "    \"委托中心\",\n" +
                        "    \"撤单操作\"\n" +
                        "  ],\n" +
                        "  \"资产管理\": [\n" +
                        "    \"我的资产\",\n" +
                        "    \"账户余额\",\n" +
                        "    \"收益分析\",\n" +
                        "    \"资金安全\"\n" +
                        "  ],\n" +
                        "  \"用户账户\": [\n" +
                        "    \"登录\",\n" +
                        "    \"注册\",\n" +
                        "    \"找回密码\",\n" +
                        "    \"修改资料\",\n" +
                        "    \"安全中心\",\n" +
                        "    \"退出登录\"\n" +
                        "  ],\n" +
                        "  \"帮助中心\": [\n" +
                        "    \"新手指南\",\n" +
                        "    \"常见问题\",\n" +
                        "    \"交易规则\",\n" +
                        "    \"投诉建议\",\n" +
                        "    \"意见反馈\",\n" +
                        "    \"服务条款\"\n" +
                        "  ],\n" +
                        "  \"关于我们\": [\n" +
                        "    \"公司简介\",\n" +
                        "    \"团队介绍\",\n" +
                        "    \"招贤纳士\",\n" +
                        "    \"联系我们\",\n" +
                        "    \"法律声明\",\n" +
                        "    \"隐私政策\"\n" +
                        "  ],\n" +
                        "  \"特色问答\": {\n" +
                        "    \"怎么开户\": \"引导用户注册并实名认证\",\n" +
                        "    \"如何买股票\": \"跳转交易中心买入功能\",\n" +
                        "    \"如何撤单\": \"说明 RabbitMQ+Redis 异步撤单逻辑\",\n" +
                        "    \"资金安全吗\": \"介绍资金安全和 Redis+JavaMail 验证机制\",\n" +
                        "    \"如何联系客服\": \"跳转联系我们页面\",\n" +
                        "    \"我想复盘\": \"进入投资决策回放模块\",\n" +
                        "    \"有没有投资课程\": \"跳转投资课堂模块\"\n" +
                        "  }\n" +
                        "}\n")
                .defaultAdvisors(
                        new MessageChatMemoryAdvisor(chatMemory),
                        new SimpleLoggerAdvisor()
                )
                .build();
    }
}
